package Demo06.Demo01;

import java.io.*;

/**
 * 一、编程：利用 IO 流，完成以下程序：
 * (1)将 26 个大写字母(A~Z)写入到当前项目a.txt 文件中;
 * (2)读取文件中的内容，将读取的内容连接为一个字符串，并将所有的大写字母转变为小写字母打印输出转换的结果。使用了(强转)
 */
public class Demo06_day01 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("G:\\XQ1.01\\a.txt");
        OutputStreamWriter os = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(os);
        for (int i =65; i <=90;i++) {
                bw.write(i);
        }
        bw.close();

        FileInputStream fis = new FileInputStream("G:\\XQ1.01\\a.txt");
        InputStreamReader isr = new InputStreamReader(fis);
        BufferedReader br = new BufferedReader(isr);
        while (true){
            int i = br.read();
            if (i==-1)break;
            char c =(char)(i+32);
            System.out.println(c);
        }
        br.close();
    }
}
